package com.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;

public class HibernateUtils {
	private static final SessionFactory sessionFactoty;
	static {
		final StandardServiceRegistry registry 
		= new StandardServiceRegistryBuilder()
		.configure().build();
		sessionFactoty = new MetadataSources(registry)
				.buildMetadata().buildSessionFactory();
	}
	public static Session getSession() {
		return sessionFactoty.openSession();
	}
}
